1 00:00:00,540 --> 00:00:02,640 I said today I want to do a little bit of code cleanup. 2 00:00:02,640 --> 00:00:04,840 I got two things that I want to change. 3 00:00:04,860 --> 00:00:10,920 One, if we get a brand new player, they get a message that they blew their daily streak. 4 00:00:10,920 --> 00:00:15,180 So we want to say something like welcome or whatever. 5 00:00:15,180 --> 00:00:24,330 And then two, the game manager is loading the character added event for some people a little bit too 6 00:00:24,330 --> 00:00:29,340 slow and then they don't get credit for their kills and deaths until they die at least once and then 7 00:00:29,340 --> 00:00:30,750 they get re added to the game. 8 00:00:30,750 --> 00:00:32,640 So let's change those. 9 00:00:32,640 --> 00:00:34,350 Let's make them a little better. 10 00:00:34,350 --> 00:00:36,810 We'll go to game manager if you don't know where it's at. 11 00:00:36,810 --> 00:00:45,570 Server script service, game manager and let's start on our our welcome screen. 12 00:00:45,570 --> 00:00:46,650 Well, not a welcome screen. 13 00:00:46,650 --> 00:00:48,270 We'll just do the welcome message. 14 00:00:48,270 --> 00:00:49,800 Maybe we'll do a screen later. 15 00:00:49,800 --> 00:00:51,510 So check daily streaks. 16 00:00:51,510 --> 00:00:52,460 That's fine. 17 00:00:52,470 --> 00:00:53,820 Initialize player. 18 00:00:53,820 --> 00:00:55,020 That's what we want. 19 00:00:55,020 --> 00:01:01,380 So what I'm going to do here is uncomment out this data store, set a sync. 20 00:01:01,380 --> 00:01:04,350 This is going to clear all my data so I can check it. 21 00:01:04,350 --> 00:01:06,450 Unfortunately, I'm going to lose all my data. 22 00:01:06,450 --> 00:01:09,750 I'm going to lose my pistol, my money, everything else. 23 00:01:09,750 --> 00:01:10,680 But that's all right. 24 00:01:10,680 --> 00:01:12,030 We've got to check this out. 25 00:01:12,030 --> 00:01:17,730 So that's going to clear our data here if somebody has data. 26 00:01:18,380 --> 00:01:19,700 They had already played. 27 00:01:19,700 --> 00:01:24,620 So we populate their leaderboard and the player info stuff on the player. 28 00:01:24,650 --> 00:01:27,680 If they have not played and they don't have data. 29 00:01:27,830 --> 00:01:33,320 We go ahead and initialize this table, but we set the streak to zero. 30 00:01:33,350 --> 00:01:34,610 Let's make that one. 31 00:01:34,610 --> 00:01:41,580 And we set the time to January 1st, 1970 at midnight, which is Epoch. 32 00:01:41,600 --> 00:01:42,710 We don't want that. 33 00:01:43,220 --> 00:01:44,810 Let's make it OSS time. 34 00:01:45,980 --> 00:01:46,730 All right. 35 00:01:46,730 --> 00:01:48,510 Now we're still going to get the error. 36 00:01:48,530 --> 00:01:49,370 We're not going to get the error. 37 00:01:49,370 --> 00:01:52,000 We're still going to get you blew your streak message. 38 00:01:52,010 --> 00:01:55,310 So we have to update the player info. 39 00:01:55,340 --> 00:01:58,280 Luckily, right here is exactly what we've got to do. 40 00:01:58,460 --> 00:02:03,500 I guess we could refactor it further so that we don't have to duplicate lines of code, but it's fine. 41 00:02:03,890 --> 00:02:04,130 All right. 42 00:02:04,130 --> 00:02:10,400 So then we're going to get our data, we're going to update our saved time and streak value in our player 43 00:02:10,400 --> 00:02:11,210 info. 44 00:02:12,110 --> 00:02:18,410 And then let's send a message to the screen using our queue service saying new player or welcome new 45 00:02:18,410 --> 00:02:19,030 player. 46 00:02:19,040 --> 00:02:20,060 So I'm going to scroll up. 47 00:02:20,060 --> 00:02:22,040 I'm just going to copy it somewhere else. 48 00:02:22,040 --> 00:02:22,790 Here it is. 49 00:02:22,790 --> 00:02:26,270 Am I my daily streak check. 50 00:02:26,270 --> 00:02:29,900 Daily streak code for you blew your streak. 51 00:02:29,930 --> 00:02:31,070 That's a good one. 52 00:02:31,610 --> 00:02:33,140 Let's go back down here. 53 00:02:33,230 --> 00:02:34,220 Paste it. 54 00:02:35,080 --> 00:02:37,510 And I'll just say, Welcome, new player. 55 00:02:45,150 --> 00:02:45,630 All right. 56 00:02:45,630 --> 00:02:49,350 Now, when we go ahead and play this, we're going to be a new player because I'm clearing out my data. 57 00:02:49,380 --> 00:02:50,610 Let's give it a shot. 58 00:02:51,910 --> 00:02:53,890 We should get our welcome new player to. 59 00:02:56,480 --> 00:02:57,080 Boom. 60 00:02:57,080 --> 00:02:58,130 Welcome, new player. 61 00:02:58,160 --> 00:03:00,570 All right, cool. 62 00:03:00,590 --> 00:03:05,360 Now we just have to make sure that our kills and death leaderboard is firing on time. 63 00:03:05,360 --> 00:03:06,350 Let's do that. 64 00:03:11,040 --> 00:03:11,430 All right. 65 00:03:11,430 --> 00:03:15,180 I am back in my game manager. 66 00:03:16,360 --> 00:03:23,200 Don't forget to comment out your set a sink so you don't clear your data every time you play the game. 67 00:03:24,000 --> 00:03:29,940 And then let's scroll on down to player added. 68 00:03:30,180 --> 00:03:32,040 All right, So Player added. 69 00:03:33,010 --> 00:03:40,030 If this character added gets connected with the player character at an event is connected after the 70 00:03:40,030 --> 00:03:47,260 player is already in the world, it won't be effective until they die and come back into the world. 71 00:03:47,260 --> 00:03:48,820 So what we've got to do. 72 00:03:50,200 --> 00:03:52,240 Is this stuff is slowing us down. 73 00:03:52,240 --> 00:03:57,530 This in particular, this initialized player data that's slow. 74 00:03:57,550 --> 00:04:00,460 Let's just go ahead and and do a cut. 75 00:04:01,650 --> 00:04:04,470 And now we'll just plop it right on down here. 76 00:04:05,940 --> 00:04:06,810 Boom! 77 00:04:07,410 --> 00:04:08,160 All right. 78 00:04:08,160 --> 00:04:12,680 And this stuff here should be fine without any data. 79 00:04:12,690 --> 00:04:14,580 It's just going to go right on through. 80 00:04:15,240 --> 00:04:16,170 And we check again. 81 00:04:16,170 --> 00:04:17,130 We do the initialize. 82 00:04:17,130 --> 00:04:18,120 We check again. 83 00:04:18,210 --> 00:04:19,230 I think we're good. 84 00:04:19,320 --> 00:04:20,400 Let's give it a shot. 85 00:04:20,640 --> 00:04:21,570 Hit play. 86 00:04:25,430 --> 00:04:27,140 And we should be playing the same day. 87 00:04:27,140 --> 00:04:28,240 So no big deal. 88 00:04:28,250 --> 00:04:29,600 Let's kill ourselves. 89 00:04:34,220 --> 00:04:34,910 Deaths. 90 00:04:34,910 --> 00:04:35,810 One. 91 00:04:35,990 --> 00:04:36,860 Good. 92 00:04:36,920 --> 00:04:37,650 Good. 93 00:04:37,670 --> 00:04:42,500 I'm going to play a little bit to make sure that we're saving our data and then get a gun, and then 94 00:04:42,500 --> 00:04:43,790 we'll see how that goes. 95 00:04:44,960 --> 00:04:45,200 All right. 96 00:04:45,200 --> 00:04:46,550 So I played a little bit. 97 00:04:46,550 --> 00:04:47,870 I got a pistol. 98 00:04:47,870 --> 00:04:50,360 I actually gave myself an extra 1000 points. 99 00:04:50,750 --> 00:04:53,150 But let's see if we got it. 100 00:04:53,160 --> 00:04:55,100 So if there's any errors, pistols here. 101 00:04:56,340 --> 00:04:57,390 That's looking good. 102 00:04:58,380 --> 00:05:03,050 We have our points and we have our kills. 103 00:05:03,060 --> 00:05:04,740 We have our deaths. 104 00:05:04,770 --> 00:05:09,840 Let me go ahead and step on a landmine real quick just to make sure it's doing doing okay. 105 00:05:13,470 --> 00:05:14,190 Yeah. 106 00:05:14,190 --> 00:05:14,980 There we go. 107 00:05:15,060 --> 00:05:16,290 We're up and running.